package com.viamo.concilia.utils;

public class Crypton {

    public static String encrypt(String toEncrypt){
            String encrypted="";
            char aux1;
            int aux_xor;
            
            for (int i=toEncrypt.length(); i>0;i--){
                    aux1=toEncrypt.substring(i-1, i).charAt(0);
                    aux_xor=(int)aux1^256;
                    encrypted+=aux_xor;
            }
            
            
            return encrypted;
            
    }
    
    public static String decrypt(String toDecrypt){
            
            String decrypted="";
            String aux1;
            int aux_xor;
            for (int i=toDecrypt.length(); i>0;i=i-3){
                    aux1=toDecrypt.substring(i-3, i);
                    aux_xor=Integer.valueOf(aux1)^256;
                    decrypted+=(char)aux_xor;
            }
            return decrypted;
    }
    
    
}